<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增工作日志')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-record-add" th:object="${workRecord}">
            <input name="reqId" th:field="*{reqId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">需求内容：</label>
                <div class="col-sm-8">
                    <div class="panel panel-info">
                        <div class="panel-heading" th:text="'编号：' + ${requirement.reqSerial}">
                        </div>
                        <div class="panel-body" th:text="${requirement.reqContent}">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label"><span style="color: red; ">*</span>工作内容：</label>
                <div class="col-sm-8">
                    <textarea name="workContent" id="workContent" class="form-control" cols="6" rows="4"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label"><span style="color: red; ">*</span>使用工作量：</label>
                <div class="col-sm-8">
                    <input name="workDays" id="workDays" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-8">
                    <label style="color: red" th:text="'本日已添加工作量：'+${#numbers.formatDecimal(workload,1,1)}"></label>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/record"
        $("#form-record-add").validate({
            focusCleanup: true,
            rules:{
                workContent:"required",
                workDays:{required:true,number:true}
            },
            message:{
                workContent:"请输入需求内容",
                workDays:"请输入数字"
            }

        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-record-add').serialize());
            }
        }

        $("input[name='markDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>